package priv.wangy.micro.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import priv.wangy.micro.common.po.http.rspn.BaseListRspn;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 数据字典
 * 为避免可能得冲突，命名未使用常用的BaseConstant
 * 来源于数据库设计
 *
 * @author zhangjq
 * @since 2023-12-18
 */
public abstract class DataDictionary {

    @Deprecated
    @Getter
    @AllArgsConstructor
    public enum TermType {
        AUTUMN("00", "秋季学期"), SPRING("01", "春季学期"), OTHER("02", "其他学期");

        private final String key;

        private final String value;

        public static TermType getByKey(String key) {
            return Arrays.stream(TermType.values()).filter(type -> Objects.equals(type.getKey(), key)).findFirst()
                    .orElse(null);
        }

        public static String getValueByKey(String key) {
            return Arrays.stream(TermType.values()).filter(type -> Objects.equals(type.getKey(), key)).findFirst()
                    .map(TermType::getValue).orElse(null);
        }
    }

    /**
     * 权限层级
     */
    public interface Layer {
        /**
         * 一级菜单
         */
        int MODULE = 0;
        /**
         * 二级菜单
         */
        int PAGE = 1;
        /**
         * 权限
         */
        int FUNCTION = 2;

        BaseListRspn.Field FIELD = new BaseListRspn.Field("AUTH_LAYER", Arrays.asList(
                new BaseListRspn.Field.Property(MODULE, "一级菜单/模块"),
                new BaseListRspn.Field.Property(PAGE, "二级菜单/页面"),
                new BaseListRspn.Field.Property(FUNCTION, "功能/按钮")));
    }

    /**
     * 时期类型
     */
    public interface TimePeriodType {
        /**
         * 早上
         */
        String EARLY = "00";
        /**
         * 上午
         */
        String MORNING = "01";
        /**
         * 下午
         */
        String AFTERNOON = "02";
        /**
         * 晚上
         */
        String NIGHT = "03";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("TIME_PERIOD", Arrays.asList(
                new BaseListRspn.Field.Property(EARLY, "早上"),
                new BaseListRspn.Field.Property(MORNING, "上午"),
                new BaseListRspn.Field.Property(AFTERNOON, "下午"),
                new BaseListRspn.Field.Property(NIGHT, "晚上")));
    }

    /**
     * 用户类型
     */
    public interface UserType {
        /**
         * 管理员
         */
        String ADMIN = "00";
        /**
         * 教师
         */
        String TEACHER = "01";
        /**
         * 学生
         */
        String STUDENT = "02";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("USER_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(ADMIN, "管理员"),
                new BaseListRspn.Field.Property(TEACHER, "教师"),
                new BaseListRspn.Field.Property(STUDENT, "学生")));
    }

    /**
     * 数据状态
     */
    public interface DataStatus {
        /**
         * 正常
         * 能从第三方查询到目标数据
         */
        String NORMAL = "00";
        /**
         * 失效
         * 未能从第三方查询到目标数据
         */
        String INVALID = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("DATA_STATUS", Arrays.asList(
                new BaseListRspn.Field.Property(NORMAL, "正常"),
                new BaseListRspn.Field.Property(INVALID, "失效")));
    }

    /**
     * 聘用类型
     */
    @Deprecated
    public interface EmployType {
        /**
         * 在编
         */
        String PERMANENT = "00";
        /**
         * 校聘
         */
        String EMPLOY = "01";
        /**
         * 支教
         */
        String SUPPORT = "02";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("EMPLOY_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(PERMANENT, "正常"),
                new BaseListRspn.Field.Property(EMPLOY, "校聘"),
                new BaseListRspn.Field.Property(SUPPORT, "支教")));
    }

    /**
     * 工作状态
     */
    @Deprecated
    public interface WorkStatus {
        /**
         * 在职
         */
        String ON_POST = "00";
        /**
         * 退休
         */
        String RETIRE = "01";
        /**
         * 支教
         */
        String SUPPORT = "02";
        /**
         * 因应病、产假等原因不在岗
         */
        String NOT_ON_POST = "03";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("WORK_STATUS", Arrays.asList(
                new BaseListRspn.Field.Property(ON_POST, "在职"),
                new BaseListRspn.Field.Property(RETIRE, "退休"),
                new BaseListRspn.Field.Property(SUPPORT, "支教"),
                new BaseListRspn.Field.Property(NOT_ON_POST, "不在岗")));
    }

    /**
     * 性别
     */
    public interface Gender {
        /**
         * 男
         */
        String MALE = "00";
        /**
         * 女
         */
        String FEMALE = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("GENDER", Arrays.asList(
                new BaseListRspn.Field.Property(MALE, "男"),
                new BaseListRspn.Field.Property(FEMALE, "女")));
    }

    /**
     * 学历
     */
    public interface Qualification {
        /**
         * 专科
         */
        String JUNIOR = "00";
        /**
         * 本科
         */
        String BACHELOR = "01";
        /**
         * 硕士
         */
        String MASTER = "02";
        /**
         * 博士
         */
        String DOCTORAL = "03";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("QUALIFICATION", Arrays.asList(
                new BaseListRspn.Field.Property(JUNIOR, "专科"),
                new BaseListRspn.Field.Property(BACHELOR, "本科"),
                new BaseListRspn.Field.Property(MASTER, "硕士"),
                new BaseListRspn.Field.Property(DOCTORAL, "博士")));
    }

    /**
     * 职称
     */
    public interface Title {
        /**
         * 初级
         */
        String PRIMARY = "00";
        /**
         * 中级
         */
        String INTERMEDIATE = "01";
        /**
         * 高级
         */
        String SENIOR = "02";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("TITLE", Arrays.asList(
                new BaseListRspn.Field.Property(PRIMARY, "初级"),
                new BaseListRspn.Field.Property(INTERMEDIATE, "中级"),
                new BaseListRspn.Field.Property(SENIOR, "高级")));
    }

    /**
     * 是或否
     */
    public interface YesOrNo {
        /**
         * 是
         */
        String YES = "00";
        /**
         * 否
         */
        String NO = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("YES_NO", Arrays.asList(
                new BaseListRspn.Field.Property(YES, "是"),
                new BaseListRspn.Field.Property(NO, "否")));
    }

    /**
     * 校区
     */
    public interface Campus {
        /**
         * 主校区/北校区
         */
        String NORTH = "00";
        /**
         * 新校区/南校区
         */
        String SOUTH = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("CAMPUS", Arrays.asList(
                new BaseListRspn.Field.Property(NORTH, "南校区"),
                new BaseListRspn.Field.Property(SOUTH, "北校区")));

        /**
         * 获取校区名称
         *
         * @param campus 校区
         * @return java.lang.String
         * @author zhangjq
         * @since 2023-11-06
         */
        default String getSimpleName(String campus) {
            return switch (campus) {
                case NORTH -> "北";
                case SOUTH -> "南";
                default -> "";
            };
        }
    }

    /**
     * 房间用途
     */
    public interface RoomUsage {
        /**
         * 空闲
         */
        String SPARE = "00";
        /**
         * 教室
         */
        String CLASSROOM = "01";
        /**
         * 办公室
         */
        String OFFICE = "02";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("ROOM_USAGE", Arrays.asList(
                new BaseListRspn.Field.Property(SPARE, "空闲"),
                new BaseListRspn.Field.Property(CLASSROOM, "教室"),
                new BaseListRspn.Field.Property(OFFICE, "办公室")));
    }

    /**
     * 教室类型
     */
    public interface ClassroomType {
        /**
         * 班级教室
         */
        String SPECIFIC = "00";
        /**
         * 公共教室
         */
        String COMMON = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("CLASSROOM_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(SPECIFIC, "班级教室"),
                new BaseListRspn.Field.Property(COMMON, "公共教室")));
    }

    /**
     * 审批状态
     */
    @Deprecated
    public interface ApproStatus {
        /**
         * 待审核
         */
        String REVIEW = "00";
        /**
         * 已拒绝
         */
        String REJECTED = "01";
        /**
         * 已通过
         */
        String PASSED = "02";
        /**
         * 已失效
         */
        String EXPIRED = "03";
        /**
         * 执行中
         */
        String EXECUTE = "04";
        /**
         * 已执行
         */
        String EXECUTED = "05";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("APPRO_STATUS", Arrays.asList(
                new BaseListRspn.Field.Property(REVIEW, "待审核"),
                new BaseListRspn.Field.Property(REJECTED, "已拒绝"),
                new BaseListRspn.Field.Property(PASSED, "已通过"),
                new BaseListRspn.Field.Property(EXPIRED, "已失效"),
                new BaseListRspn.Field.Property(EXECUTE, "执行中"),
                new BaseListRspn.Field.Property(EXECUTED, "已执行")));

        BaseListRspn.Field SIMPLE_FIELD = new BaseListRspn.Field("APPRO_STATUS", Arrays.asList(
                new BaseListRspn.Field.Property(REVIEW, "待审核"),
                new BaseListRspn.Field.Property(REJECTED, "已拒绝"),
                new BaseListRspn.Field.Property(PASSED, "已通过")));
    }

    /**
     * 教学活动类型
     */
    public interface ActiveType {
        /**
         * 机动
         */
        String RESERVE = "00";
        /**
         * 顶岗实习
         */
        String PRACTICE = "01";
        /**
         * 入学教育
         */
        String ORIENTATION = "02";
        /**
         * 军训
         */
        String MILITARY_TRAINING = "03";
        /**
         * 社会实践
         */
        String SOCIAL_PRACTICE = "04";
        /**
         * 复习考试
         */
        String REVISING_EXAM = "05";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("ACTIVE_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(RESERVE, "机动"),
                new BaseListRspn.Field.Property(PRACTICE, "顶岗实习"),
                new BaseListRspn.Field.Property(ORIENTATION, "入学教育"),
                new BaseListRspn.Field.Property(MILITARY_TRAINING, "军训"),
                new BaseListRspn.Field.Property(SOCIAL_PRACTICE, "社会实践"),
                new BaseListRspn.Field.Property(REVISING_EXAM, "复习考试")));
    }

    /**
     * 课程类型/性质
     */
    public interface CourseType {
        /**
         * 公共基础课
         */
        String PUBLIC_BASE = "01";
        /**
         * 专业基础课
         */
        String SPECIALITY_BASE = "02";
        /**
         * 专业核心课
         */
        String SPECIALITY_CORE = "03";
        /**
         * 专业拓展课
         */
        String SPECIALITY_EXPAND = "04";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("COURSE_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(PUBLIC_BASE, "公共基础课"),
                new BaseListRspn.Field.Property(SPECIALITY_BASE, "专业基础课"),
                new BaseListRspn.Field.Property(SPECIALITY_CORE, "专业核心课"),
                new BaseListRspn.Field.Property(SPECIALITY_EXPAND, "专业拓展课")));
    }

    /**
     * 请假类型
     */
    public interface OffWorkType {
        /**
         * 年假
         */
        String ANNUAL = "00";
        /**
         * 事假
         */
        String PERSONAL = "01";
        /**
         * 病假
         */
        String SICK = "02";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("OFF_WORK_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(ANNUAL, "年假"),
                new BaseListRspn.Field.Property(PERSONAL, "事假"),
                new BaseListRspn.Field.Property(SICK, "病假")));
    }

    /**
     * 启用标识
     */
    public interface Enabled extends YesOrNo {
        /**
         * 启用
         */
        String ENABLED = YesOrNo.YES;
        /**
         * 禁用
         */
        String DISABLED = YesOrNo.NO;

        BaseListRspn.Field FIELD = new BaseListRspn.Field("ENABLED", Arrays.asList(
                new BaseListRspn.Field.Property(ENABLED, "启用"),
                new BaseListRspn.Field.Property(DISABLED, "禁用")));
    }

    /**
     * 删除标识
     */
    public interface Deleted {
        /**
         * 已删除
         */
        String DELETED = YesOrNo.YES;
        /**
         * 未删除
         */
        String UNDELETED = YesOrNo.NO;

        BaseListRspn.Field FIELD = new BaseListRspn.Field("DELETED", Arrays.asList(
                new BaseListRspn.Field.Property(DELETED, "已删除"),
                new BaseListRspn.Field.Property(UNDELETED, "未删除")));
    }

    /**
     * 德育活动主题
     */
    public interface MoralActTopic {
        /**
         * 习近平新时代中国特色社会主义思想教育
         */
        String SXJY = "00";
        /**
         * “四史”教育
         */
        String SSJY = "01";
        /**
         * 社会主义核心价值观教育
         */
        String HXJZGJY = "02";
        /**
         * 爱国主义教育
         */
        String AGZYJY = "03";
        /**
         * 中华优秀传统文化教育
         */
        String CTWHJY = "04";
        /**
         * 法治教育
         */
        String FZJY = "05";
        /**
         * 国家安全教育
         */
        String GJAQJY = "06";
        /**
         * 劳动教育
         */
        String LDJY = "07";
        /**
         * 健康教育
         */
        String JKJY = "08";
        /**
         * 职业生涯教育
         */
        String ZYSYJY = "09";
        /**
         * 其他
         */
        String QT = "10";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("MORAL_ACT_TOPIC", Arrays.asList(
                new BaseListRspn.Field.Property(SXJY, "习近平新时代中国特色社会主义思想教育"),
                new BaseListRspn.Field.Property(SSJY, "“四史”教育"),
                new BaseListRspn.Field.Property(HXJZGJY, "社会主义核心价值观教育"),
                new BaseListRspn.Field.Property(AGZYJY, "爱国主义教育"),
                new BaseListRspn.Field.Property(CTWHJY, "中华优秀传统文化教育"),
                new BaseListRspn.Field.Property(FZJY, "法治教育"),
                new BaseListRspn.Field.Property(GJAQJY, "国家安全教育"),
                new BaseListRspn.Field.Property(LDJY, "劳动教育"),
                new BaseListRspn.Field.Property(JKJY, "健康教育"),
                new BaseListRspn.Field.Property(ZYSYJY, "职业生涯教育"),
                new BaseListRspn.Field.Property(QT, "其他")));
    }

    /**
     * 德育活动类型
     */
    public interface MoralActType {
        /**
         * 讲座报告
         */
        String JZBG = "00";
        /**
         * 征文演讲
         */
        String ZWYJ = "01";
        /**
         * 文艺表演
         */
        String WYBY = "02";
        /**
         * 参观走访
         */
        String CGZF = "03";
        /**
         * 志愿服务
         */
        String ZYFW = "04";
        /**
         * 社会实践
         */
        String SHSJ = "05";
        /**
         * 分享交流
         */
        String FXJL = "06";
        /**
         * 其他
         */
        String QT = "07";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("MORAL_ACT_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(JZBG, "讲座报告"),
                new BaseListRspn.Field.Property(ZWYJ, "征文演讲"),
                new BaseListRspn.Field.Property(WYBY, "文艺表演"),
                new BaseListRspn.Field.Property(CGZF, "参观走访"),
                new BaseListRspn.Field.Property(ZYFW, "志愿服务"),
                new BaseListRspn.Field.Property(SHSJ, "社会实践"),
                new BaseListRspn.Field.Property(FXJL, "分享交流"),
                new BaseListRspn.Field.Property(QT, "其他")));
    }

    /**
     * 主办单位级别
     */
    public interface HostLevel {
        /**
         * 国家级
         */
        String GJJ = "00";
        /**
         * 省部级
         */
        String SBJ = "01";
        /**
         * 地市级
         */
        String DSJ = "02";
        /**
         * 区县级
         */
        String QXJ = "03";
        /**
         * 其他
         */
        String QT = "09";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("HOST_LEVEL", Arrays.asList(
                new BaseListRspn.Field.Property(GJJ, "国家级"),
                new BaseListRspn.Field.Property(SBJ, "省部级"),
                new BaseListRspn.Field.Property(DSJ, "地市级"),
                new BaseListRspn.Field.Property(QXJ, "区县级"),
                new BaseListRspn.Field.Property(QT, "其他")));
    }

    /**
     * 寝室类型
     */
    public interface DormType {
        /**
         * 男寝
         */
        String MALE = "00";
        /**
         * 女寝
         */
        String FEMALE = "01";
        /**
         * 男女混寝
         */
        String ALL = "02";

        BaseListRspn.Field SHOW_FIELD = new BaseListRspn.Field("SHOW_DORM_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(MALE, "男寝"),
                new BaseListRspn.Field.Property(FEMALE, "女寝"),
                new BaseListRspn.Field.Property(ALL, "男女混寝")));

        BaseListRspn.Field FIELD = new BaseListRspn.Field("DORM_TYPE", Arrays.asList(
                new BaseListRspn.Field.Property(MALE, "男寝"),
                new BaseListRspn.Field.Property(FEMALE, "女寝")));
    }

    /**
     * 寝室类别
     */
    public interface DormAttr {
        /**
         * 学生宿舍
         */
        String STUDENT = "00";
        /**
         * 功能房
         */
        String FUNCTION = "01";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("DORM_ATTR", Arrays.asList(
                new BaseListRspn.Field.Property(STUDENT, "学生宿舍"),
                new BaseListRspn.Field.Property(FUNCTION, "功能房")));
    }

    /**
     * 房间性质
     */
    public interface RoomAttr {

        /**
         * 多媒体(教室、会议室)
         */
        String MULTIMEDIA = "FF";
    }

    /**
     * 房间类型
     */
    public interface RoomType {
        /**
         * 空房间
         */
        String EMPTY = "00";
        /**
         * 教室
         */
        String CLASSROOM = "01";
        /**
         * 办公室
         */
        String OFFICE = "02";
        /**
         * 会议室
         */
        String MEETING_ROOM = "03";
        /**
         * 宿舍
         */
        String DORMITORY = "04";
        /**
         * 功能房
         */
        String FUNCTIONAL_ROOM = "09";

        BaseListRspn.Field TCH_ROOM_FIELD = new BaseListRspn.Field("ROOM_USAGE", Arrays.asList(
                new BaseListRspn.Field.Property(EMPTY, "空闲"),
                new BaseListRspn.Field.Property(CLASSROOM, "教室"),
                new BaseListRspn.Field.Property(OFFICE, "办公室")));

        BaseListRspn.Field DORM_ROOM_FIELD = new BaseListRspn.Field("DORM_ATTR", Arrays.asList(
                new BaseListRspn.Field.Property(DORMITORY, "学生宿舍"),
                new BaseListRspn.Field.Property(FUNCTIONAL_ROOM, "功能房")));

        List<String> TCH_ROOM_TYPES = List.of(EMPTY, CLASSROOM, OFFICE);
        List<String> DORM_ROOM_TYPES = List.of(DORMITORY, FUNCTIONAL_ROOM);
    }

    /**
     * 建筑类型
     */
    public interface BldgType {
        /**
         * 教学楼
         * 包含教室、办公室、会议室(报告厅)
         */
        String TEACHING = "00";
        /**
         * 宿舍楼
         * 包含宿舍、功能房(宿管办公室)
         */
        String DORMITORY = "01";
        /**
         * 综合楼
         * 可能同时存在所有类型的房间
         * 暂未使用
         */
        String MULTIPLE_USE = "09";
    }

    /**
     * 合作形式
     */
    public interface CoopKind {
        /**
         * 工学交替
         */
        String WORK_LEARN = "00";
        /**
         * 订单班
         */
        String ORDER_CLASS = "01";
        /**
         * 共建工作室
         */
        String CO_STUDIO = "02";
        /**
         * 合作开发课程
         */
        String CO_DEV_CUS = "03";
        /**
         * 合作编写教材
         */
        String CO_TCH_MAT = "04";
        /**
         * 项目引入
         */
        String PRJ_INTRO = "05";
        /**
         * 实训基地
         */
        String TRAIN_BASE = "06";
        /**
         * 其他
         */
        String OTHER = "09";
    }

    /**
     * 学制
     */
    @Deprecated
    public interface EducationSystem {

        int YEAR_NUM = 3;

        int TERM_NUM = 6;
    }

    /**
     * 专业技术职务等级
     */
    public interface MajorPostLayer {
        /**
         * 正高级
         */
        String ZGJ = "00";
        /**
         * 副高级
         */
        String FGJ = "01";
        /**
         * 中级
         */
        String ZJ = "02";
        /**
         * 初级（助理级）
         */
        String CJ = "03";


        String WU = "F1";


        BaseListRspn.Field FIELD = new BaseListRspn.Field("MAJOR_POST_LAYER", Arrays.asList(
                new BaseListRspn.Field.Property(ZGJ, "正高级"),
                new BaseListRspn.Field.Property(FGJ, "副高级"),
                new BaseListRspn.Field.Property(ZJ, "中级"),
                new BaseListRspn.Field.Property(CJ, "初级"),
                new BaseListRspn.Field.Property(WU, "无")));
    }

    /**
     * 教师认定类别
     * {@link TchDataDictionary.Confirm.Qualification}
     */
    @Deprecated
    public interface TeacherQualification {
        /**
         * 优秀教师
         */
        String YXJS = "00";
        /**
         * 学科带头人
         */
        String XKDTR = "01";
        /**
         * 专业带头人
         */
        String ZYDTR = "02";
        /**
         * 骨干教师
         */
        String GGJS = "03";
        /**
         * 教学名师
         */
        String JXMS = "04";
        /**
         * 技术能手
         */
        String JSNS = "05";
        /**
         * 双师型教师
         */
        String SSXJS = "06";
        /**
         * 优秀班主任
         */
        String YXBZR = "07";
        /**
         * 其他
         */
        String QT = "99";

        BaseListRspn.Field FIELD = new BaseListRspn.Field("TEACHER_QUALIFICATION", Arrays.asList(
                new BaseListRspn.Field.Property(YXJS, "优秀教师"),
                new BaseListRspn.Field.Property(XKDTR, "学科带头人"),
                new BaseListRspn.Field.Property(ZYDTR, "专业带头人"),
                new BaseListRspn.Field.Property(GGJS, "骨干教师"),
                new BaseListRspn.Field.Property(JXMS, "教学名师"),
                new BaseListRspn.Field.Property(JSNS, "技术能手"),
                new BaseListRspn.Field.Property(SSXJS, "双师型教师"),
                new BaseListRspn.Field.Property(YXBZR, "优秀班主任"),
                new BaseListRspn.Field.Property(QT, "其他")));
    }

    public interface MemberType {
        /**
         * 教职工
         */
        String STAFF = "00";
        /**
         * 学生
         */
        String STUDENT = "01";
        /**
         * 班级
         */
        String CLASS = "02";
    }
}

